<template>

  <a-modal :title="title"
           :width="1200"
           :visible="visible"
           @ok="handleCancel"
           @cancel="visible=false"
           cancelText="关闭"
  >
<!--    <a-card :bordered="false">-->

      <!-- table区域-begin -->
    <a-spin :spinning="confirmLoading">
        <div class="" style="width: 1100px; height: 100px;display: flex" >
          <a-form-item label="昵称" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <a-input v-model="wxUserInfo.nickname" disabled></a-input>
          </a-form-item>
          <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <span v-if="wxUserInfo.sex == 1">
                <a-input placeholder="男" disabled />
            </span>
            <span v-if="wxUserInfo.sex == 2">
              <a-input placeholder="女" disabled ></a-input>
            </span>
          </a-form-item>
          <a-form-item label="手机号" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <a-input  v-model="wxUserInfo.mobile" disabled></a-input>
          </a-form-item>
          <a-form-item label="所在地" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <a-input  v-model="wxUserInfo.country" disabled></a-input>
          </a-form-item>
        </div>

        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true}"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="patientInfo"
          :pagination="ipagination"
          :loading="loading"
          :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
          class="j-table-force-nowrap"
          @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
           <a @click="handlePatienData(record)">详情</a>
        </span>
        </a-table>
    </a-spin>
    <patient-data-modal ref="patientDataModal"></patient-data-modal>
<!--      <wx-user-list-modal ref="wxUserListModal"></wx-user-list-modal>-->
<!--      <wx-userinfo-modal ref="modalForm" @ok="modalFormOk"></wx-userinfo-modal>-->
<!--    </a-card>-->
  </a-modal>


</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { mixinDevice } from '@/utils/mixin'
import Area from '@comp/_util/Area'
import { getAction } from '@api/manage'
import PatientDataModal from '../../patient/modules/PatientDataModal'

export default {
  name: "WxUserListModal",
  mixins:[JeecgListMixin, mixinDevice],
  components: {
    PatientDataModal
  },
  data () {
    return {
      description: 'wx_userinfo管理页面',
      title:"用户信息",
      visible:false,
      confirmLoading: false,
      wx_userinfo_id: " ",
      id:" ",
      labelCol: {
        xs: { span: 8 },
        sm: { span: 8 },

      },
      wrapperCol: {
        xs: { span: 20 },
        sm: { span: 16 },
      },
      columns: [
        {
          title:'患者id',
          align:"center",
          dataIndex: 'id'
        },
        {
          title:'患者姓名',
          align:"center",
          dataIndex: 'name'
        },
        {
          title:'该患者与用户关系',
          align:"center",
          dataIndex: 'relation',
          customRender:function (res) {
            //关系 1本人 2子女 3父母 4夫妻
            var str = "未标示";
            if(res == 1){
              str = "本人";
            }else if(res == 2){
              str = "子女";
            }else if(res == 3){
              str = "父母";
            }else if(res == 4){
              str = "夫妻";
            }
            return str;
          }
        },
        {
          title:'问诊单数量',
          align:"center",
          dataIndex: ''
        },
        {
          title: '操作',
          dataIndex: 'action',
          align:"center",
          fixed:"right",
          width:147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        queryById: "/wuser/wxUserinfo/queryById",
        list: "/wuser/wxUserinfo/queryByUserInfo",
        web:"/inquiry/inquiryInfo/queryById",
      },
      wxUserInfo:{},   //用户数据
      patientInfo:{},  //患者数据

    }
  },
  created() {
  },
  methods: {
    initDictConfig(){
    },
    viewShow(record){
      let param = {id:record.id};
      getAction(this.url.list, param).then(res => {
        this.wxUserInfo = res.result[0];
        this.patientInfo = res.result[1];
      })
      this.visible = true;
    },

    handleCancel(){
      this.visible = false;
    },
    handlePatienData(record){
      this.$refs.patientDataModal.showPatien(record);
    }
  }
}
</script>

<style scoped>


@import '~@assets/less/common.less';
</style>